package com.atguigu.mvc.controller;

import com.atguigu.mvc.controller.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * @author durant
 * @create 2021-11-01 9:47
 */
@Controller
public class ParamController {
    @RequestMapping("/testServerletAPI")
    // 形参位置的request表示当前请求
    public String testServerletAPI(@RequestParam(value = "user_name",required = false) String username, String password, String hobby ,
                                   @CookieValue(value = "JSESSIONID",required = false) String JSESSIONID ){

        System.out.println("username:"+username+",password:"+password+"hobby:"+hobby);
        System.out.println("JSESSIONID"+JSESSIONID);
        return  "success";
    }
    @RequestMapping("/testpojo")
    public String testpojo(User user){
        System.out.println("user:"+user);

        return  "success";
    }
}
